import Vue from "vue";
import store from './store/index';
import App from "./discipline.vue";
import router from "./router/disciplineRouter";
import '@/filter'

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI)

import { MessageBox } from 'element-ui';

// 存储路径中的token
let hash = window.location.hash.split('?')
if (hash.length > 1) {
  let arr = hash[1].split('=')
  if (arr.length > 1) {
    window.sessionStorage.setItem('access_token', arr[1])
  }
}

router.beforeEach((to, from, next) => {
  if (window.sessionStorage.getItem('access_token')) {
    next()
  } else {
    MessageBox.confirm('暂未授权', '', {
      showClose: false,
      showCancelButton:false,
      showConfirmButton:false,
      closeOnClickModal:false,
      closeOnPressEscape:false
    })
  }
})

import '@/assets/style/index.less'
Vue.config.productionTip = false;

window.echarts = require('echarts');

// 引入swiper
import VueAwesomeSwiper from "vue-awesome-swiper";
import "../node_modules/swiper/css/swiper.css";
Vue.use(VueAwesomeSwiper);

import "./assets/iconfont/iconfont.css"; //引用阿里矢量图


import Viewer from 'v-viewer'
import '../node_modules/viewerjs/dist/viewer.css'
Vue.use(Viewer)

import checkedTitle from './components/checkedtitle.vue'
Vue.component('checkedTitle', checkedTitle)

import ScreenModal from './components/ScreenModal/ScreenModal.vue'
Vue.component('ScreenModal', ScreenModal)

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount("#app");